package com.youlu.campus.web.qa;
import com.youlu.campus.service.activity.ActivityVideoService;
import com.youlu.campus.web.common.base.RequestContext;
import com.yuelin.infrastructure.quantum.common.QResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 活动视频点赞控制器
 */
@RestController
public class ActivityKikeController {
    @Autowired
    private ActivityVideoService activityVideoService;

    /**
     * 是否点赞
     *
     * @param
     * @return
     */
    @GetMapping("/mini-app/activity/qa/liked")
    public QResult liked(@RequestParam(name = "activityId") String activityId,
                         @RequestParam(name = "qaId") String qaId) {
        return QResult.success(activityVideoService.isDianZan(RequestContext.getUserId(), activityId,
                qaId));
    }







    /**
     * 点赞
     *
     * @param
     * @return
     */
    @GetMapping("/mini-app/activity/qa/like")
    public QResult like(@RequestParam(name = "activityId") String activityId,
                         @RequestParam(name = "qaId") String qaId) {
        return QResult.success(activityVideoService.dianZan(RequestContext.getUserId(), activityId,
                qaId));
    }
    /**
     * 取消点赞
     *
     * @param
     * @return
     */
    @GetMapping("/mini-app/activity/qa/unlike")
    public QResult unLike(@RequestParam(name = "activityId") String activityId,
                        @RequestParam(name = "qaId") String qaId) {
        return QResult.success(activityVideoService.cancelDianZan(RequestContext.getUserId(), activityId,
                qaId));
    }
}
